package open.witype.filetiper.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

import open.witype.filetiper.R;
import open.witype.filetiper.activity.home.HomeActivity;
import open.witype.filetiper.database.DBHelper;


/**
 * Created by Typer on 2015/5/10 0010.
 *
 */
public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        readySql();
        startToMain();
    }

    public void readySql(){
        DBHelper helper = new DBHelper(getApplicationContext());
        helper.copyDatabaseFile(getApplicationContext());
    }

    public void startToMain(){
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(new Intent(getApplicationContext(),HomeActivity.class));
                finish();
            }
        },1000);
    }
}
